<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<script>
	
	var AJAX_URL = "";
	
	<logic:present name="search_vo">
		<c:choose>
			<c:when test="${search_vo.trainSearchType eq '3'}">
				AJAX_URL = "app/train/search?from=${search_vo.trainStationFrom}&to=${search_vo.trainStationTo}";
			</c:when>
			<c:when test="${search_vo.trainSearchType eq '2'}">
				AJAX_URL = "app/train/search?station=${search_vo.trainStationName}";
			</c:when>
		</c:choose>
	</logic:present>
	
	function switch_page (page) {

		var page = page || $("#rdpage").val();

		if (AJAX_URL != "") {
			
			page_load ("train_data", AJAX_URL, {}, page, (function(){
					polish_table_hover_bytbl("datagrid");
				}
			));
		} else {
			alert ("错误请求.");
		}
	}

</script>

<logic:present name="search_vo">
	<c:choose>
		<c:when test="${search_vo.trainSearchType eq '1'}">
			<%@ include file="dataTrainInfo.jsp"%>
		</c:when>
		<c:when test="${search_vo.trainSearchType eq '3'}">
			<%@ include file="dataTrainP2P.jsp"%>
		</c:when>
		<c:when test="${search_vo.trainSearchType eq '2'}">
			<%@ include file="dataTrainStations.jsp"%>
		</c:when>
	</c:choose>
</logic:present>